import { IPSSysDataSyncAgent } from './ipssys-data-sync-agent';
import { IPSSysSFPlugin } from './ipssys-sfplugin';
import { IPSSubSysServiceAPI } from '../service/ipssub-sys-service-api';
import { IPSSystemModule } from '../system/ipssystem-module';
import { PSModelObjectImpl } from '../psmodel-object-impl';

export class PSSysDataSyncAgentImpl extends PSModelObjectImpl implements IPSSysDataSyncAgent {
  get agentParams(): IModel {
    return this.M.agentParams;
  }

  get agentTag(): string {
    return this.M.agentTag;
  }

  get agentTag2(): string {
    return this.M.agentTag2;
  }

  get agentType(): 'KAFKA' | 'RABBITMQ' | 'ACTIVEMQ' | 'MQTT' | 'STOMP' | 'WS' | 'INTERNAL' | 'USER' | 'USER2' | 'USER3' | 'USER4' {
    return this.M.agentType;
  }

  get authClientId(): string {
    return this.M.authClientId;
  }

  get authClientSecret(): string {
    return this.M.authClientSecret;
  }

  get authMode(): 'NONE' | 'AUTHORIZATION_CODE' | 'PASSWORD' | 'CLIENT_CREDENTIALS' | 'IMPLICIT' | 'USER' | 'USER2' {
    return this.M.authMode;
  }

  get authParam(): string {
    return this.M.authParam;
  }

  get authParam2(): string {
    return this.M.authParam2;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get groupId(): string {
    return this.M.groupId;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected pssubsysserviceapi: IPSSubSysServiceAPI | null = null;

  getPSSubSysServiceAPI(): IPSSubSysServiceAPI | null {
    if (this.pssubsysserviceapi != null) return this.pssubsysserviceapi;
    const value = this.M.getPSSubSysServiceAPI;
    if (value == null) {
      return null;
    }
    this.pssubsysserviceapi = this.getPSModel4('service.IPSSubSysServiceAPI', value, 'getPSSubSysServiceAPI') as IPSSubSysServiceAPI;
    return this.pssubsysserviceapi;
  }

  get psSubSysServiceAPI(): IPSSubSysServiceAPI | null {
    return this.getPSSubSysServiceAPI();
  }

  getPSSubSysServiceAPIMust(): IPSSubSysServiceAPI {
    const value = this.getPSSubSysServiceAPI();
    if (value == null) {
      throw new Error('未指定外部服务接口');
    }
    return value;
  }

  protected pssyssfplugin: IPSSysSFPlugin | null = null;

  getPSSysSFPlugin(): IPSSysSFPlugin | null {
    if (this.pssyssfplugin != null) return this.pssyssfplugin;
    const value = this.M.getPSSysSFPlugin;
    if (value == null) {
      return null;
    }
    this.pssyssfplugin = this.getPSModel4('res.IPSSysSFPlugin', value, 'getPSSysSFPlugin') as IPSSysSFPlugin;
    return this.pssyssfplugin;
  }

  get psSysSFPlugin(): IPSSysSFPlugin | null {
    return this.getPSSysSFPlugin();
  }

  getPSSysSFPluginMust(): IPSSysSFPlugin {
    const value = this.getPSSysSFPlugin();
    if (value == null) {
      throw new Error('未指定后台扩展插件');
    }
    return value;
  }

  protected pssystemmodule: IPSSystemModule | null = null;

  getPSSystemModule(): IPSSystemModule | null {
    if (this.pssystemmodule != null) return this.pssystemmodule;
    const value = this.M.getPSSystemModule;
    if (value == null) {
      return null;
    }
    this.pssystemmodule = this.getPSModel4('system.IPSSystemModule', value, 'getPSSystemModule') as IPSSystemModule;
    return this.pssystemmodule;
  }

  get psSystemModule(): IPSSystemModule | null {
    return this.getPSSystemModule();
  }

  getPSSystemModuleMust(): IPSSystemModule {
    const value = this.getPSSystemModule();
    if (value == null) {
      throw new Error('未指定系统模块');
    }
    return value;
  }

  get serviceParam(): string {
    return this.M.serviceParam;
  }

  get serviceParam2(): string {
    return this.M.serviceParam2;
  }

  get servicePath(): string {
    return this.M.servicePath;
  }

  get syncDir(): 'IN' | 'OUT' {
    return this.M.syncDir;
  }

  get topic(): string {
    return this.M.topic;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get rawDataMode(): boolean {
    return this.M.rawDataMode != null ? this.M.rawDataMode : false;
  }

  get cls(): string {
    return 'PSSysDataSyncAgentImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'res.IPSSysDataSyncAgent') return true;
    return super.instanceof(cls);
  }
}
